package com.andy.controller.common;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

@ControllerAdvice
public class GlobalExceptionResolver {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handleException(Exception exception, HttpServletResponse response){
        Result result = new Result();
        result.setStatus("0");
        result.setMessage(exception.getMessage());
        return result;
    }

}
